<template>
	<view>
		<view class="u-p-20 bg_FFFFFF">
			<view class="u-b-r-34 u-flex" style="background-color:#F3F3F3 ;padding-left: 20rpx;">
				<view class="u-h-30">
					<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img.png' width='28rpx' height='28rpx'></u-image>
				</view>

				<view class="u-p-l-10 u-w-600">
					<u-input type='text' v-model="value" @blur="inputBlur" :border='false' placeholder='请输入商品名称/订单编号'></u-input>
				</view>

			</view>
		</view>
		<u-tabs-swiper @change='change' ref="tabs" active-color='#FC3533' :list="list" :is-scroll="false"
			:current='current'></u-tabs-swiper>
		<!-- 待分享 -->
		<view class="u-p-20 " v-for="(item,index) in array" :key="index">

			<view class="bg_FFFFFF u-p-20 u-m-t-20 u-b-r-16">

				<view class="u-p-20 u-flex u-row-between" style="border-bottom: 1rpx solid #F4F1F1;">
					<view class="u-flex" @click="$u.route('/pages/shopmassage/shopmassage?num='+item.shop_id)">
						<view class="u-h-36">
							<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img1.png' width='36rpx' height='36rpx'></u-image>
						</view>
						<view class="u-p-l-10 u-weight u-h-36">{{item.shop_name}}</view>
						<view class="u-p-l-20 u-h-36">
							<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img2.png' width='20rpx' height='20rpx'></u-image>
						</view>
					</view>
					<view v-if="item.is_supplement==1" class="">
						<u-tag text="补差价订单" type="error" :closeable="false" />
					</view>
					<!-- {{item.status}} -->
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==1">待分享</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==2">待核销</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==3">待发货</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==4">待收货</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==5">待评价</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==6">已完成</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==-1">已取消</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==99">待审核</view>
				</view>

				<view class="u-p-20 " style="border-bottom: 1rpx solid #F4F1F1;"
					@click="$u.route('/subcontract/halfprice/massage/massage?num='+item.order_sn)"
					v-for="(items,indexs) in item.item" :key="indexs">
					<view class="u-flex u-row-between">
						<view class="u-flex">
							<view class="">
								<u-image :src='items.imgs[0]' width='183rpx' height='183rpx'></u-image>
							</view>
							<view class="u-p-l-10 ">
								<view class="u-weight ">{{items.goods_name}}</view>
								<!-- <view class="u-weight u-p-t-10">可口30克*12枚</view> -->
								<view class="u-font-20 u-m-t-10">
									{{items.spece_content}}
								</view>
								<view class=" u-p-t-10" style="color: #FC3533;">￥{{items.price}}</view>
							</view>

						</view>
						<view class="u-font-20" style="color:#454545;">{{items.num}}</view>
					</view>
					<view class="u-m-t-10" v-if="item.status==1">
						<view class="u-p-20" style="background-color: #FFF3ED;">
							<view class="u-flex">
								<view class="u-font-26">贡献值进度:</view>
								<view class="u-w-300 u-m-l-20">
									<u-line-progress active-color="#FF5502"
										:percent="Number(((item.all_conval/item.con_val)*100).toFixed(2))"></u-line-progress>
								</view>
							</view>
							<view class="u-flex u-m-t-20">
								<view class="">所需贡献值:</view>
								<view class="" style="color: #FF5502;">{{item.con_val}}</view>
							</view>
							<view class="u-flex u-font-26 u-m-t-20">

								<view class="u-flex ">
									<view class="">已累计贡献值:</view>
									<view class="" style="color: #FF5502;">{{item.all_conval}}</view>
								</view>
								<view class="u-flex u-m-l-20">
									<view class="">剩余贡献值:</view>
									<view class="" style="color: #FF5502;">{{(item.con_val-item.all_conval).toFixed(2)}}
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="u-p-20">
					<view class="" style="color: #FC3533;text-align: right;">合计:￥{{item.total_amount}}</view>

					<view class=" u-m-t-30">
						<u-row justify='end'>
							<block v-if="item.con_val-item.all_conval===0&&item.status!==3">
								<u-col :span='3' v-if="item.con_val-item.all_conval===0&&item.status!==3">
									<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
										style="background-color: #FC3533;" @click="updateGoodsStatus(item.id)">
										我要发货</view>
								</u-col>
								<u-col :span='3'>
									<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
										style="border: 1rpx solid #FC3533;color: #FC3533;" @click="remove_good(item.id,item,true)">
										我要退款
									</view>
								</u-col>
							</block>
							<block v-else>
								<u-col :span='3' v-if="item.is_supplement==0 && (item.status==1 || item.status==2 ||item.status==3)">
									<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
										style="border: 1rpx solid #FC3533;color: #FC3533;" @click="remove_good(item.id,item,false)">
										<!-- {{(item.status==2 || item.status==3)?'我要退款':'结束订单'}} -->
										结束订单
									</view>
								</u-col>

								<u-col :span='3' v-if="item.is_show_apply_supplement==1">
									<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
										style="background-color: #FC3533;" @click="supplement_apply(item)">
										申请补差价</view>
								</u-col>
								<u-col :span='3' v-if="item.is_show_supplement==1 && item.status==1">
									<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
										style="background-color: #FC3533;" @click="payInfo=item,show8=true">
										补差价</view>
								</u-col>
								<u-col :span='3' v-if="item.supplement_apply_status==3 && item.status==1">
									<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
										style="background-color: #FC3533;" @click="select_cause(item)">
										拒绝原因</view>
								</u-col>
								<u-col :span='3' v-if="item.status==1">
									<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
										style="background-color: #FC3533;" @click="getWin(item)">
										获取贡献值</view>
								</u-col>
								<u-col :span='3' v-if="item.status==1">
									<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
										style="background-color: #FC3533;" @click="true_one(item.id)">优先订单</view>
								</u-col>

							</block>



							<u-col :span='3' v-if="item.status==2">
								<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
									style="background-color: #FC3533;" @click="selectScan(item)">查看二维码</view>
							</u-col>

							<u-col :span='3' v-if="item.status==4 && item.is_apply_invoice==2">
								<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
									style="border: 1rpx solid #FC3533;color: #FC3533;" @click="go_open(item)">申请开票
								</view>
							</u-col>
							<u-col :span='3' v-if="item.transport_type==1 && item.status>=4">
								<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
									style="border: 1rpx solid #FC3533;color: #FC3533;"
									@click="$u.route(`/subcontract/originalprice/logistics/logistics?order_sn=${item.order_sn}`)">
									查看物流</view>
							</u-col>
							<!-- <u-col :span='3'  v-if="item.status==4">
								<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
									style="border: 1rpx solid #FC3533;color: #FC3533;" @click="show2=true">申请售后</view>
							</u-col> -->
							<u-col :span='3' v-if="item.status==4">
								<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
									style="background-color: #FC3533;" @click="true_get(item.id)">确认收货</view>
							</u-col>
							<u-col :span='3' v-if="item.status==4 || item.status==5 || item.status==6">
								<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
									style="border: 1rpx solid #FC3533;color: #FC3533;" @click="select_open(item)">查看发票
								</view>
							</u-col>

							<u-col :span='3' v-if="item.status==5">
								<view class="u-m-t-10 u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
									style="background-color: #FC3533;"
									@click="$u.route('/subcontract/originalprice/evaluate/evaluate?num='+item.id)">去评价
								</view>
							</u-col>
						</u-row>
					</view>
				</view>
			</view>
		</view>
		<view class="u-p-20">
			<u-loadmore :status="loadStatus" icon-type="circle" />
		</view>

		<!-- 结束订单 -->
		<u-mask :show="show">
			<view class="u-w-600 u-auto u-m-t-160">
				<view class="u-abso" style="left: 400rpx;top: 250rpx;">
					<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/spc.png" mode="aspectFill" width="216rpx"
						height='274rpx'>
					</u-image>
				</view>
				<view class=" u-p-30 bg_FFFFFF u-b-r-16" style="margin-top: 400rpx;">
					<!-- <view class="u-font-50 u-weight">{{orderStatus==2 || orderStatus==3?'取消订单':'结束订单'}}</view> -->
					<view class="u-font-50 u-weight" v-if="isTuikuan">我要退款</view>
					<view class="u-font-50 u-weight" v-else>结束订单</view>
					<view class="" v-if="!isTuikuan">
						<view class="u-p-t-20 u-font-20 u-l-h-48">
							结束订单将返还您此商品原价80%到您的余额账户
						</view>
					</view>
					<!-- 	<view v-if="order_info.is_supplement!=1" class="u-m-t-20">
						<u-parse :html="orderStatus==2 || orderStatus==3?cancelInfo:endInfo"></u-parse>
					</view>
					<view v-else class="">
						<u-parse :html="supplement_cancel_msg"></u-parse>
					</view> -->
					<view class="" v-else>
						确认退款系统将自动退本订单原价金额的{{order_info.cancel_percent}}({{order_info.cancel_amount}}元)到余额请确认!
					</view>
					<view class="u-flex u-m-t-20">
						<view @click="show=false" class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto  u-b-r-20"
							style="background-color: #FFEAEAFF;color: #FC3533FF;">我再想想</view>

						<view @click="true_remove_list"
							class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto cl_FFF u-b-r-20"
							style="background-color: #FC3533FF;">确认</view>

					</view>

				</view>
			</view>

		</u-mask>

		<!-- 优先订单 -->
		<u-mask :show="show5">
			<view class="u-w-600 u-auto u-m-t-160">
				<view class="u-abso" style="left: 400rpx;top: 250rpx;">
					<u-image src="https://www.sqkjkj.vip/wxImg/contribution/img7.png" mode="aspectFill" width="216rpx"
						height='274rpx'>
					</u-image>
				</view>
				<view class=" u-p-40 bg_FFFFFF u-b-r-16" style="margin-top: 400rpx;">
					<view class="u-font-50 u-weight">优先订单</view>


					<view class="">

						<view class="u-p-t-40 u-font-20 u-l-h-48">
							选择为优先订单后，
							平台优先分配贡献值给此订单
						</view>

					</view>
					<view class="u-flex u-m-t-20">
						<view @click="show5=false" class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto  u-b-r-20"
							style="background-color: #FFEAEAFF;color: #FC3533FF;">取消</view>

						<view @click="one_lists"
							class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto cl_FFF u-b-r-20"
							style="background-color: #FC3533FF;">提交</view>

					</view>

				</view>
			</view>
		</u-mask>

		<!-- 我要发货 -->
		<u-mask :show="show10">
			<view class="u-w-600 u-auto u-m-t-160">
				<view class="u-abso" style="left: 400rpx;top: 250rpx;">
					<u-image src="https://www.sqkjkj.vip/wxImg/contribution/img7.png" mode="aspectFill" width="216rpx"
						height='274rpx'>
					</u-image>
				</view>
				<view class=" u-p-40 bg_FFFFFF u-b-r-16" style="margin-top: 400rpx;">
					<view class="u-font-50 u-weight">我要发货</view>


					<view class="">

						<view class="u-p-t-40 u-font-20 u-l-h-48">
							确认发货卖家将为您发货无商品质量问题不接受退款!如有其它问题请联系卖家。
						</view>

					</view>
					<view class="u-flex u-m-t-20">
						<view @click="show10=false"
							class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto  u-b-r-20"
							style="background-color: #FFEAEAFF;color: #FC3533FF;">取消</view>

						<view @click="handleFh"
							class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto cl_FFF u-b-r-20"
							style="background-color: #FC3533FF;">提交</view>

					</view>

				</view>
			</view>
		</u-mask>

		<!-- 申请售后 -->
		<u-mask :show="show2" @click='show2=false'>
			<view class="u-w-600 u-b-r-20 bg_FFFFFF u-p-30 u-auto " style="margin-top: 300rpx;">

				<view class="u-flex u-row-between u-p-b-40" style="border-bottom: 1rpx solid #DFDFDF;">
					<view class="">我要退款(未收到货)</view>
					<view class="" @click.stop="$u.route('/subcontract/originalprice/returngoods/returngoods?num=1')">
						<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img7.png' width='28rpx' height='28rpx'></u-image>
						<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img23.png' width='28rpx' height='28rpx'></u-image>
					</view>
				</view>

				<view class="u-flex u-row-between u-m-t-30">
					<view class="">我要退款(未收到货)</view>
					<view class="" @click.stop="$u.route('/subcontract/originalprice/returngoods/returngoods?num=2')">
						<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img7.png' width='28rpx' height='28rpx'></u-image>
						<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img23.png' width='28rpx' height='28rpx'></u-image>
					</view>
				</view>
			</view>
		</u-mask>

		<u-mask :show="fpShow">
			<view class="warp">
				<view class="u-w-700 auto bg_FFFFFF u-p-20 u-b-r-20">
					<view class="u-p-t-20 u-p-b-20 u-text-right" @click="fpShow=false">
						<u-icon name="close-circle-fill" size="50"></u-icon>
					</view>
					<!-- <image src="" mode="aspectFit"></image> -->
					<u-image width="680rpx" height="700rpx" mode="aspectFit" :src="fpList.img"></u-image>

					<view @click="saveImg" class="u-m-t-20 u-w-660 bg_zs u-p-20 u-text-center u-b-r-20 cl_FFF">
						保存发票图片
					</view>
				</view>
			</view>
		</u-mask>

		<!-- 查看二维码 -->
		<u-mask :show="show6">
			<view class="warp">
				<view class="u-w-700 u-b-r-20 bg_FFFFFF u-p-t-20 u-p-b-40">
					<view @click="show6 = false" class="u-p-20 u-text-right">
						<u-icon size="50" name="close-circle-fill"></u-icon>
					</view>
					<view class="u-text-center">
						<view class="u-font-26 u-weight">
							请出示此码给商家核销，核销表示您已收到所购商品。
						</view>
						<u-image class="u-m-t-20 u-auto" :src='scanList.qrcode_url' width='650rpx' height='400rpx'
							mode="aspectFit"></u-image>
					</view>
				</view>
			</view>
		</u-mask>
		<uni-popup ref="sharepopup" type="bottom">
			<share-btn :sharedataTemp="sharedata"></share-btn>
		</uni-popup>
		<!-- 确认收货 -->
		<u-modal v-model="show7" content="请确认是否已经收到货" @confirm='true_get_good' :show-cancel-button='true'></u-modal>
		<!-- 取消订单 -->
		<u-picker mode="selector" v-model="show4" :default-selector="[0]" :range="no_lick_list"
			@confirm='true_remove_good'></u-picker>
		<!-- 支付弹窗 -->
		<u-popup v-model="show8" mode="bottom">
			<view class="bg_FFFFFF u-b-r-12">
				<view class="u-p-20">
					<text class="u-weight">补差价金额：</text>
					<text class="cl_FF5502FF">￥{{payInfo.supplement_money}}</text>
				</view>
				<view @click="openEpayDialog" class="u-flex u-row-between u-p-30" style="border-bottom: 1rpx solid #F6F6F6FF;">
					<view class="u-flex">
						<view class=" u-flex">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/card.png" mode="aspectFill" width="50rpx"
								height='50rpx'>
							</u-image>
							<view class="u-m-l-30 u-font-28 ">钱包支付</view>
						</view>
						<view class="u-m-l-30 cl_898989FF u-font-24">可用<text class="cl_FB473CFF">￥{{yu.user_wallet || 0}}</text>
						</view>
					</view>
					<view class="u-flex">
						<view class="">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-if="pays=='deposit'"></u-image>
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-else>
							</u-image>
						</view>
					</view>

				</view>

				<view @click="openEpayDialog" class="u-flex u-row-between u-p-30" style="border-bottom: 1rpx solid #F6F6F6FF;">
					<view class="">
						<view class=" u-flex">
							<u-image src="http://xcx.itcwc.com/wxImg/5dcf4786109a5.png" mode="aspectFill" width="50rpx" height='50rpx'>
							</u-image>
							<view class="u-m-l-30 u-font-28 ">易支付</view>
						</view>

					</view>
					<view class="u-flex">
						<!-- <view class="u-m-r-20 cl_FB473CFF">-￥{{userinfo.goods_amount}}</view> -->
						<view class="">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-if="pays == 'epay'"></u-image>
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-else>
							</u-image>
						</view>
					</view>
				</view>

				<view @click="pays='wechat'" class="u-flex u-row-between u-p-30" style="border-bottom: 1rpx solid #F6F6F6FF;">
					<view class="">
						<view class=" u-flex">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/wx.png" mode="aspectFill" width="50rpx"
								height='50rpx'>
							</u-image>
							<view class="u-m-l-30 u-font-28 ">微信支付</view>
						</view>

					</view>
					<view class="u-flex">
						<view class="">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-if="pays=='wechat'"></u-image>
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-else>
							</u-image>
						</view>
					</view>
				</view>
				<!-- #ifdef APP-PLUS -->
				<view @click="pays='alipay'" class="u-flex u-row-between u-p-30" style="border-bottom: 1rpx solid #F6F6F6FF;">
					<view class="">
						<view class=" u-flex">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/zf.png" mode="aspectFill" width="50rpx"
								height='50rpx'>
							</u-image>
							<view class="u-m-l-30 u-font-28 ">支付宝支付</view>
						</view>
					</view>
					<view class="u-flex">
						<view class="">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-if="pays=='alipay'"></u-image>
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-else>
							</u-image>
						</view>
					</view>
				</view>
				<!-- #endif -->
			</view>
			<!-- 立即支付 -->
			<view class=" u-h-120 u-w-750 bg_FFFFFF">
				<view @click="true_pays" class="u-w-640 u-auto u-h-98 bl2C_3F u-l-h-98 u-text-center u-b-r-20 u-auto"
					style="letter-spacing: 4rpx;color: #ffffff;">立即支付</view>
			</view>
		</u-popup>
		<u-popup v-model="shows" mode='center'>
			<view class="u-p-30 u-h-200">
				<u-message-input :focus="true" :maxlength='6' @change="changes" @finish="finish"></u-message-input>
			</view>
		</u-popup>

		<!-- 易支付选择弹窗 -->
		<u-popup v-model="showEpayDialog" mode="center" width="80%" border-radius="10">
			<view class="epay-dialog">
				<view class="epay-dialog-title">请选择支付方式</view>
				<view class="epay-dialog-content">
					<view class="epay-payment-option" @click="selectEpayMethod('wxpay')">
						<view class="radio-button">
							<view class="radio-inner" :class="{ 'radio-selected': epayParams.epay_type === 'wxpay' }"></view>
						</view>
						<view class="payment-icon">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/wx.png" mode="aspectFill" width="40rpx"
								height='40rpx'></u-image>
						</view>
						<view class="payment-name">微信支付</view>
					</view>
					<!-- 在微信小程序环境下不显示支付宝支付选项 -->
					<view class="epay-payment-option" @click="selectEpayMethod('alipay')" v-if="!isWechatMP">
						<view class="radio-button">
							<view class="radio-inner" :class="{ 'radio-selected': epayParams.epay_type === 'alipay' }"></view>
						</view>
						<view class="payment-icon">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/zf.png" mode="aspectFill" width="40rpx"
								height='40rpx'></u-image>
						</view>
						<view class="payment-name">支付宝支付</view>
					</view>
				</view>
				<view class="epay-dialog-footer">
					<view class="epay-dialog-btn cancel-btn" @click="showEpayDialog = false">取消</view>
					<view class="epay-dialog-btn confirm-btn" @click="confirmEpayMethod">确定</view>
				</view>
			</view>
		</u-popup>

		<u-toast ref="uToast" />
	</view>
</template>

<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import shareBtn from '@/components/share-btn/share-btn.vue';
export default {
	components: {
		uniPopup,
		shareBtn
	},
	data() {
		return {
			// 结束订单
			show: false,
			// 取消订单
			show4: false,
			// 查看发票
			show3: false,
			// 修改地址弹窗
			show1: false,
			// 是否为默认地址
			num: 0,
			// 申请售后弹窗
			show2: false,
			// 优先订单
			show5: false,
			// 查看二维码
			show6: false,
			// 确认收货
			show7: false,
			// 补差价
			shows: false,
			show8: false,
			// 搜索的内容
			value: "",
			// 分享传递的参数
			sharedata: {
				type: 1,
				strShareUrl: "http://192.168.1.188:8080/h5/#/",
				strShareTitle: "分享标题",
				strShareSummary: "分享总结",
				strShareImageUrl: "http://www.xuelejia.com/xljapp/h5/static/aboutUsLogo.png"
			},
			// 状态切换
			current: '0',
			list: [{
				name: '全部',
				count: 0,
				type: ''
			}, {
				name: '待分享',
				count: 0,
				type: 1
			},
			{
				name: '待核销',
				count: 0,
				type: 2
			}, {
				name: '待发货',
				count: 0,
				type: 3
			}, {
				name: '待收货',
				count: 0,
				type: 4
			}, {
				name: '待评价',
				count: 0,
				type: 5
			},
			{
				name: '已完成',
				count: 0,
				type: 6
			},
			{
				name: '已取消',
				count: 0,
				type: -1
			}
			],
			status: 0,
			array: [],
			order_id: '',
			order_info: '',
			no_lick_list: [],
			userinfo: '',
			// 补差价
			yu: '',
			pays: '',
			payInfo: '',
			supplement_cancel_msg: '',
			fpShow: false,
			fpList: '',
			scanList: '',
			endInfo: '',
			orderStatus: '',
			cancelInfo: '',
			params: {
				page: 1,
				page_size: 20,
				type: 3,
				status: '',
				keywords: ''
			},
			loadStatus: 'loadmore',
			innerAudioContext: null,
			rule: '',
			show10: false,
			isTuikuan: false,
			// 易支付相关参数
			showEpayDialog: false,
			isWechatMP: false,
			epayParams: {
				epay_type: 'wxpay',
				method: '',
			},
		}
	},
	onHide() {
		this.innerAudioContext.stop()
	},
	onUnload() {
		this.innerAudioContext.stop()
	},
	onLoad(obj) {
		this.current = obj.num
		this.params.status = this.list[this.current].type
		// 获取订单列表
		this.userinfo = uni.getStorageSync('userinfo')
		this.sharedata.strShareUrl = this.sharedata.strShareUrl + '?num=' + this.userinfo.regcode
		this.clear()
		this.massage()
		this.$api.orderDubbing({}, res => {
			this.innerAudioContext = uni.createInnerAudioContext();
			this.innerAudioContext.src = res.data.data.half
			this.innerAudioContext.play()
		})
		this.$api.getRule({}, res => {
			this.rule = res.data.data.rule
			// console.log(res.data.data.rule)
		})
		// 检测设备类型
		this.detectDeviceType()
	},
	onShow() {
		this.yu = uni.getStorageSync("userinfo")
		this.supplement_cancel_msg = uni.getStorageSync("conf").supplement_cancel_msg
		this.bjg_close_des()
		this.bjg_cancel_des()
	},
	// 下拉到底事件
	onReachBottom() {
		//避免多次触发
		if (this.loadStatus == 'loading' || this.loadStatus == 'nomore') {
			return;
		}
		this.massage();
	},
	methods: {
		updateGoodsStatus(order_id) {
			this.order_id = order_id
			this.show10 = true
		},
		handleFh() {
			this.$api.updateOrderStatus({ id: this.order_id }, res => {
				if (res.data.code == 1) {
					this.show10 = false
					uni.showToast({
						icon: 'success',
						title: '发货成功'
					})
					this.clear()
					this.massage()
				}
			})

		},
		inputBlur() {
			this.clear()
			this.massage()
		},
		bjg_close_des() {
			this.$api.bjg_close_des({}, res => {
				if (res.data.code == 1) {
					this.endInfo = res.data.data
				}
			})
		},
		bjg_cancel_des() {
			this.$api.bjg_cancel_des({}, res => {
				if (res.data.code == 1) {
					this.cancelInfo = res.data.data
				}
			})
		},
		clear() {
			this.array = [];
			this.params.page = 1;
		},
		// 获取订单信息
		massage() {
			this.params.keywords = this.value
			this.$api.people_pay_list(this.params, res => {
				if (res.data.code == 1) {
					if (res.data.data.data.length < 20) {
						this.loadStatus = 'nomore';
					} else {
						this.params.page = this.params.page + 1;
						this.loadStatus = 'loadmore';
					}
					this.array = this.array.concat(res.data.data.data);
					uni.stopPullDownRefresh();
				}
			})
		},
		// 点击分享触发弹窗
		shareOn() {
			this.$refs.sharepopup.open();
		},
		// 点击取消订单
		remove_good(obj, item, isTuikuan) {
			this.order_id = obj
			this.order_info = item
			this.orderStatus = item.status
			this.isTuikuan = isTuikuan
			this.show = true
		},
		// 申请补差价
		supplement_apply(item) {
			this.$api.supplement_apply({
				order_sn: item.order_sn
			}, res => {
				if (res.data.code == 1) {
					uni.showToast({
						icon: 'success',
						title: res.data.msg
					})
					this.clear()
					this.massage()
				}
			})
		},
		// 查看原因
		select_cause(item) {
			uni.showModal({
				title: '原因',
				content: item.supplement_refuse_reason,
				success: (s) => {

				}
			})
		},
		// 补差价
		true_pays() {
			console.log(this.pays)
			if (this.pays == 'deposit') {
				// if (uni.getStorageSync('userinfo').have_trade_pwd == 0) {
				// 	uni.showModal({
				// 		title: '提示',
				// 		content: '请先设置余额支付密码',
				// 		success: (res) => {
				// 			if (res.confirm) {
				// 				this.$u.route('/pages/changePayPassword/changePayPassword')
				// 			} else {

				// 			}
				// 		}
				// 	})
				// 	return
				// }
				// this.shows = true
				this.pay()
			} else if (this.pays == 'epay') {
				// 易支付
				let params = {
					target_id: this.payInfo.supplement_target_id,
					target_type: this.payInfo.supplement_target_type,
					pay_type: this.pays,
					type: this.epayParams.epay_type,
					method: this.epayParams.method,
					// 根据不同平台设置不同的client参数
					// #ifdef APP-PLUS
					client: 'APP',
					// #endif
					// #ifdef MP-WEIXIN || MP-ALIPAY
					client: 'JSAPI',
					// #endif
					// #ifdef H5
					client: 'WAP',
					// #endif
					random: 1
				}
				this.$com.easyPay(params, this.pays);
			} else {
				// #ifdef APP-PLUS
				this.$com.wxPay({
					target_id: this.payInfo.supplement_target_id,
					target_type: this.payInfo.supplement_target_type,
					pay_type: this.pays,
					client: "APP",
					trade_pwd: ''
				}, this.pays).then(ok => {
					this.$refs.uToast.show({
						title: ok.data.msg,
						type: 'success',
						callback: cal => {
							this.$u.route({
								type: 'reLaunch',
								url: '/pages/my/my'
							})
						}
					})
				})
				// #endif

				// #ifdef MP-WEIXIN
				this.$com.weChatPay({
					target_id: this.payInfo.supplement_target_id,
					target_type: this.payInfo.supplement_target_type,
					pay_type: this.pays,
					client: "JSAPI",
					trade_pwd: ''
				}, this.pays).then(ok => {
					this.$refs.uToast.show({
						title: ok.msg,
						type: 'success',
						callback: cal => {
							this.$u.route({
								type: 'reLaunch',
								url: '/pages/my/my'
							})
						}
					})
				})
				// #endif
			}
		},
		pay(obj = '') {
			uni.showLoading({
				title: '支付中',
				mask: true
			});
			this.$api.go_pay({
				target_id: this.payInfo.supplement_target_id,
				target_type: this.payInfo.supplement_target_type,
				pay_type: this.pays,
				client: "APP",
				trade_pwd: obj
			}, res => {
				uni.hideLoading();
				if (res.data.code == 1) {
					uni.showToast({
						icon: 'success',
						title: '支付成功'
					})
					setTimeout(() => {
						uni.switchTab({
							url: '/pages/my/my'
						})
					}, 500)

				} else {
					uni.showToast({
						icon: 'none',
						title: res.data.msg
					})
				}
			})
		},
		changes(e) { },
		finish(e) {
			this.pay(e)
			this.shows = false
		},
		// 点击确定
		true_remove_list() {
			// 获取原因
			this.$api.get_good_get({}, res => {
				this.no_lick_list = res.data.data
			})
			this.show4 = true
			this.show = false

		},
		// 点击确定取消按钮
		true_remove_good(e) {
			this.$api.remove_pay_list_detal({
				order_id: this.order_id,
				order_cancel_cause: this.no_lick_list[e[0]],
				remark_reason: ''
			}, res => {
				if (res.data.code == 1) {
					uni.showToast({
						icon: 'success',
						title: '取消成功'
					})
					this.clear()
					this.massage()
					this.show5 = false
				} else {
					uni.showToast({
						icon: 'error',
						title: res.data.msg
					})
				}
			})
		},
		// 点击确认收货
		true_get(obj) {
			this.order_id = obj
			this.show7 = true
		},
		true_get_good() {
			this.$api.true_pay_list_detal({
				order_id: this.order_id
			}, res => {
				if (res.data.code == 1) {
					uni.showToast({
						icon: 'success',
						title: '收货成功'
					})
					this.clear()
					this.massage()
					this.show5 = false
				} else {
					uni.showToast({
						icon: 'error',
						title: res.data.msg
					})
				}
			})
		},
		//切换状态
		change(e) {
			this.current = e
			this.params.status = this.list[this.current].type
			this.clear()
			this.massage()
		},
		// 点击申请开票
		go_open(item) {
			uni.setStorageSync("open_massage", item)
			uni.navigateTo({
				url: "/subcontract/originalprice/Invoicing/Invoicing"
			})
		},
		// 优先订单
		true_one(id) {
			this.order_id = id
			this.show5 = true
		},
		one_lists() {
			this.$api.one_list({
				order_id: this.order_id
			}, res => {
				uni.showToast({
					icon: 'none',
					title: res.data.msg
				})
				if (res.data.code == 1) {
					this.show5 = false
					let num = 1
					let arr = uni.getStorageSync("one_list")
					if (arr) {
						arr = arr * 1 + 1
						uni.setStorageSync('one_list', arr)
					} else {
						uni.setStorageSync('one_list', num)
					}
					this.clear()
					this.massage()
				}
			})
		},
		// 保存图片
		save() { },
		getWin(item) {
			// console.log(item)

			uni.showModal({
				title: '提示',
				cancelText: '退款',
				confirmText: '做任务',
				content: this.rule,
				success: (one) => {
					if (one.confirm) {
						uni.setStorageSync('winList', item)
						this.updateOrderTimingStatus(item.id)
					} else {
						this.remove_good(item.id, item, true)
					}

				}
			})

		},
		updateOrderTimingStatus(id) {
			this.$api.updateOrderTimingStatus({ id }, (res) => {
				this.$u.route('/subcontract/halfprice/get/get')
			})

		},
		select_open(item) {
			this.$api.view_invoice({
				order_id: item.id
			}, res => {
				if (res.data.code == 1) {
					this.fpShow = true
					this.fpList = res.data.data
				}
			})
		},
		selectScan(item) {
			this.$api.order_finish_after_verification_qrcode({
				order_sn: item.order_sn
			}, res => {
				if (res.data.code == 1) {
					this.scanList = res.data.data
					this.show6 = true
				}
			})
		},
		// 保存图片
		saveImg() {
			uni.downloadFile({
				url: this.fpList.img,
				success: (res) => {
					uni.saveImageToPhotosAlbum({
						filePath: res.tempFilePath,
						success: (res2) => {
							this.fpShow = false
							uni.showToast({
								icon: 'none',
								title: '保存成功'
							})
						},
						fail: (f) => {
							console.log(f)
						}
					})
				}
			})
		},
		openEpayDialog() {
			this.pays = 'epay'
			this.showEpayDialog = true
		},
		selectEpayMethod(method) {
			this.epayParams.epay_type = method
		},
		confirmEpayMethod() {
			this.showEpayDialog = false
		},
		// 检测设备类型
		detectDeviceType() {
			// #ifdef H5
			this.epayParams.method = 'web' // H5环境使用web
			this.isWechatMP = false
			// #endif

			// #ifdef MP-WEIXIN
			this.epayParams.method = 'jsapi' // 微信小程序环境使用jsapi
			this.isWechatMP = true
			// #endif

			// #ifdef MP-ALIPAY
			this.epayParams.method = 'jsapi' // 支付宝小程序环境使用jsapi
			this.isWechatMP = false
			// #endif

			// #ifdef APP-PLUS
			this.epayParams.method = 'web' // APP环境使用app
			this.isWechatMP = false
			// #endif

			console.log('当前设备类型:', this.epayParams.method)
		},
	}
}
</script>

<style scoped>
page {
	background: #f5f5f5;
}

.bgc {
	background: #F4F4F4;
}

.bgc1 {
	background: #FFF2F2;
	border: 1rpx solid #FC3533;
}

.error {
	width: 74rpx;
	height: 160rpx;
	background: url('https://www.sqkjkj.vip/wxImg/common/home/img12.png') no-repeat;
	background-size: 100% 100%;
}

/* 易支付选择弹窗样式 */
.epay-dialog {
	background-color: #fff;
	padding: 30rpx;
}

.epay-dialog-title {
	font-size: 32rpx;
	font-weight: bold;
	text-align: center;
	margin-bottom: 30rpx;
}

.epay-dialog-content {
	padding: 20rpx 0;
}

.epay-payment-option {
	display: flex;
	align-items: center;
	padding: 20rpx 0;
	border-bottom: 1rpx solid #f5f5f5;
}

.radio-button {
	width: 36rpx;
	height: 36rpx;
	border-radius: 50%;
	border: 2rpx solid #ddd;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 20rpx;
}

.radio-inner {
	width: 20rpx;
	height: 20rpx;
	border-radius: 50%;
	background-color: transparent;
}

.radio-selected {
	background-color: #3298FD;
}

.payment-icon {
	margin-right: 20rpx;
}

.payment-name {
	font-size: 28rpx;
}

.epay-dialog-footer {
	display: flex;
	justify-content: space-between;
	margin-top: 40rpx;
}

.epay-dialog-btn {
	width: 45%;
	height: 80rpx;
	border-radius: 40rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28rpx;
}

.cancel-btn {
	background-color: #f5f5f5;
	color: #666;
}

.confirm-btn {
	background-color: #3298FD;
	color: #fff;
}
</style>